package top.guxx.springframework.beans;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author：Guxx
 * @Description：属性集合
 * @Date：2024/6/9 17:41
 * @Filename：PropertyValues
 */
public class PropertyValues {
    private List<PropertyValue> propertyValueList = new ArrayList<>();

    //增加属性至属性列表
    public void addPropertyValue(PropertyValue propertyValue){
        propertyValueList.add(propertyValue);
    }
    //获取属性数组
    public PropertyValue[] getPropertyValuesArray(){
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }
    //根据属性名获取属性
    public PropertyValue getPropertyValue(String name){
        for (PropertyValue propertyValue : propertyValueList) {
            if (propertyValue.getName().equals(name)){
                return propertyValue;
            }
        }
        return null;
    }
}
